<template>
	<div class="hisSelectWrap">
        <div class="hisSelectItem">
            <span class="itemName">区域：</span>
            <span class="itemCon">{{location}}</span>
        </div>
        <div class="hisSelectItem" @click="selectTime('start')">
            <span class="itemName">开始日期：</span>
            <span class="itemCon">{{startTime}}</span>
        </div>
		<div class="hisSelectItem" @click="selectTime('end')">
            <span class="itemName">结束日期：</span>
            <span class="itemCon">{{endTime}}</span>
        </div>
		<div class="hisSelectItem">
            <span class="itemName">站点：</span>
            <span class="itemCon">{{`${$store.getters.location[2].name}`}}站点</span>
        </div>
		<div class="hisSelectItemKey" v-if="false">
            <div class="itemKeyName">要素：</div>
			<div class="itemKeyPart">
				<van-radio-group v-model="radio">
					<van-radio name="1">气温</van-radio>
					<van-radio name="2">雨量</van-radio>
					<van-radio name="3">相对湿度</van-radio>
					<van-radio name="4">风况</van-radio>
					<van-radio name="5">能见度</van-radio>
					<van-radio name="6">气压</van-radio>
				</van-radio-group>
			</div>
        </div>
		<div class="btnArea">
			<van-button @click="cancelBtn" type="default">取消</van-button>
			<van-button @click="confrimBtn" type="primary">确认</van-button>
		</div>
	</div>
</template>
<script type="text/javascript">
	export default{
		data () {
			return {
				index:0,
				result: [],
				radio:"",
				type:"",
				startTime:"",
				endTime:"",
				location:"",
			}
		},
		mounted (){
			this.location = `${this.$store.getters.location[1].name}${this.$store.getters.location[2].name}`;
			this.startTime = this.$util.getBeforeDay(-1,'ymd');
			this.endTime = this.$util.getBeforeDay(-1,'ymd');
        },
        watch:{
            
        },
		components : {
			
		},
		methods : {
			onClickLeft(){
				this.$router.go(-1);
			},
			cancelBtn(){
				this.$emit("cancel")
			},
			confrimBtn(){
				let startTimeDate = new Date(this.startTime).getTime();
				let endTimeDate = new Date(this.endTime).getTime();
				if(startTimeDate > endTimeDate){
					this.$toast("开始时间不能大于结束时间，请重新选择")
					return
				}
				this.$emit("confrim")
			},
			selectTime(type){
				this.type = type;
				this.$emit("selectTime",type);
			},
			setTime(value,type){
				if(this.type == 'start'){
					this.startTime = value; 
				}else{
					this.endTime = value;
				}
			}
		}
	}
</script>
<style type="text/css" lang="less">
	.hisSelectWrap{
		.hisSelectItem{
			padding:25px 10px 0;
			font-size:16px;
		}
		.itemName{
			color:#999;
		}
		.hisSelectItemKey{
			padding:25px 10px 0;
			color:#999;
		}
		.itemKeyPart{
			padding-top: 15px;
		}
		.van-radio{
			margin-right: 32px;
    		margin-bottom: 20px;
		}
		.btnArea{
			text-align: center;
			margin-top: 20px;
		}
		.van-button--normal{
			width: 40%;
		}
		.van-button--normal:first-child{
			margin-right: 10px;
		}
    }
</style>